import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleneseTestCase;

public class First extends SeleneseTestCase {
	@Before
	public void setUp() throws Exception {
		selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1/");
		selenium.start();
	}

	@Test
	public void testFirst() throws Exception {
		
		MainGeradorSenha geradorSenha = new MainGeradorSenha(1); // SQLEXPRESS
		
		selenium.open("/Cardapio.NetEnvironment/home.aspx");
		selenium.click("css=#span_vMENUITEM_0001 > a");
		selenium.waitForPageToLoad("30000");
		selenium.click("id=INSERT");
		selenium.waitForPageToLoad("30000");

		geradorSenha.gerar();

		selenium.type("id=ALIMENTONOME", "---" + geradorSenha.getNovaSenha() + " :: " + geradorSenha.getSenhaAtual() + "---");
		selenium.type("id=ALIMENTOMEDIDA", "1 pct");
		selenium.type("id=ALIMENTOPONTOS", "4 pt");
		selenium.click("name=BTN_ENTER");
		selenium.click("link=Home");
		selenium.waitForPageToLoad("30000");
	}

	@After
	public void tearDown() throws Exception {
		selenium.stop();
	}
}
